#ifndef THREAD_H
#define THREAD_H

#include <unistd.h>
#include <pthread.h>

namespace concurrent {

class Thread
{
public:
	Thread();
	virtual ~Thread() {};
	bool start();
	bool join();
	bool sleep(unsigned int millisec);
	bool isRunning() { return _running; }

protected:
	static void *entryPoint(void *);

	virtual void setup() {}
	virtual void teardown() {}
	virtual void run() = 0;

private:
	pthread_t _threadId;
	bool _running;
};

}

#endif /* THREAD_H */

